Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Remove duplicate validation summary entries #57

Conversation

AndyButland
Copy link
Contributor

@AndyButland AndyButland commented Jul 24, 2023

This should resolve #56 (and #1053 in Umbraco Forms).

This issue was the rendering of multiple, identical messages for required checkbox or radio button lists - with the PR in place we now only have one per fieldset:

image

I've done this will two extra checks in rendering the summary bullet points:

  • If adding a message for a checkbox or radio button which may be "invalid" even though it's actually valid due to another item with the same input name being checked, check that the field itself is invalid before adding a message.
  • Not added if an identical message has already been added.

I also fixed up an issue found in testing this along with a previous update, which was that in these cases where we add or remove an error from other inputs with the same name, we weren't updating the cached this.summary value for all inputs. This caused the summary to not render sometimes as it was considered unchanged.

To test this you should be able to look at the "Checkboxes" demo which I've updated to include a radio button list too, as well as a validation summary element.

Copy link
Owner

@haacked haacked left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

👍🏻 LGTM. Thanks for the thorough PR!

@haacked haacked merged commit 509383c into haacked:main Jul 24, 2023
1 check passed
@AndyButland AndyButland deleted the bugfix/remove-duplicate-validation-summary-entries branch July 25, 2023 04:22
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Validation summary presents duplicate elements with required checkbox or radio button lists
2 participants